import requests
import execjs

url='https://match.yuanrenxue.com/api/match/2'
with open('test.js','r',encoding='utf-8')as fp:
    jscode=fp.read()
get_m=execjs.compile(jscode)
headers={
    'User-Agent':'yuanrenxue.project',

}
cookies={'sessionid':'wfqqlbjeupxzz8al2b6i40jv5afbktz5',
         }
session=requests.session()
session.headers=headers
session.cookies.update(cookies)
all_sum=0
for page in range(1,6):
    c={'m':f'{get_m.call("get_m")}'}
    session.cookies.update(c)
    params={
        'page':str(page)
    }
    res=session.get(url,params=params).json()
    value_sum=0
    for i in res.get('data'):
        value_sum+=i.get('value')
    all_sum+=value_sum
    print(f'第{page}页和为', value_sum)
print(f'{page}页总和', all_sum)
